#!/bin/bash

while getopts "PShv" Option
do
 case $Option in
  h ) echo "Usage: `basename $0`"\
       "program_name test_name"
      echo
      echo "Create a symbolic link to the test input file as"
      echo "  ln -s program_name.in.test_name program_name.in"
      exit;;
 esac
done
shift $(($OPTIND - 1))

if [ $# -ne 2 ]
 then
  echo "Wrong input: `basename $0` -h for help"
  exit 1
fi

link_name="$1.in"
test_file_name="${link_name}.$2"

if [ ! -e ${test_file_name} ]
 then
  echo "The input file \"${test_file_name}\" does not exists!"
  exit 1
fi

if [ -h ${link_name} ]
 then
  unlink ${link_name}
fi

ln -s ${test_file_name} ${link_name}

